/*
 * time_probe.h
 *
 *  Created on: 2008-9-26
 *      Author: fanliangliang
 */

#ifndef TEST_TIME_PROBE_H_
#define TEST_TIME_PROBE_H_

#include "toxic.h"

using namespace toxic;

void do_test_time_probe() {

	cout << "***** time_probe *****" << endl;

	// Use manual TimeProbe
	TimeProbe tp1("Busy Loop", false);

	double d1 = 1.2345678;
	double d2 = 2.3456789;
	for (int i = 0; i < 1000000; ++i) {
		d1 *= (d2 + d1) / 3.1415926 * (-1.258);
	}

	// Manual stop
	tp1.stop();


	for (int i = 0; i < 10; ++i) {
		// Use auto TimeProbe
		TimeProbe tp2("Sleep Loop");

		Thread::sleep(100);
	}


	// Print result
	TimeProbe::report();
}


#endif /* TEST_TIME_PROBE_H_ */
